package edu.ccut.saturn.studio.component.common;

import edu.ccut.saturn.studio.core.util.eclipse.Messages;

/**
 * 
 * @author Bai Yucheng 2007-12-5
 * 
 */
public class CommonSet {
	public static String[] classTypes = {
			"java.lang.Object", "java.lang.String", //$NON-NLS-1$ //$NON-NLS-2$
			"java.lang.Integer", "java.lang.Float", "java.lang.Double", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
			"java.lang.Boolean", "java.lang.Characte", "java.lang.Byte", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
			"java.lang.Short", "edu.ccut.saturn.component.SaturnData", //$NON-NLS-1$ //$NON-NLS-2$
			"java.util.ArrayList", "java.util.HashMap", "java.util.LinkedList" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

	public static String[] passingTypes = {
			Messages.getString("CommonSet.input"), Messages.getString("CommonSet.output"), Messages.getString("CommonSet.inputandoutput") }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

	public static String[] scopes = {
			"logic", "request", "session", "application" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$

	public static String convert(String str) {
		if (str.equals(Messages.getString("CommonSet.input"))) { //$NON-NLS-1$
			return "in"; //$NON-NLS-1$
		}
		if (str.equals(Messages.getString("CommonSet.output"))) { //$NON-NLS-1$
			return "out"; //$NON-NLS-1$
		}
		if (str.equals(Messages.getString("CommonSet.inputandoutput"))) { //$NON-NLS-1$
			return "in-out"; //$NON-NLS-1$
		}
		if (str.equals("logic")) { //$NON-NLS-1$
			return "1"; //$NON-NLS-1$
		}
		if (str.equals("request")) { //$NON-NLS-1$
			return "2"; //$NON-NLS-1$
		}
		if (str.equals("session")) { //$NON-NLS-1$
			return "5"; //$NON-NLS-1$
		}
		if (str.equals("application")) { //$NON-NLS-1$
			return "10"; //$NON-NLS-1$
		}
		return ""; //$NON-NLS-1$
	}

	public static String reverseConvert(String str) {
		if (str.equals("in")) { //$NON-NLS-1$
			return Messages.getString("CommonSet.input"); //$NON-NLS-1$
		}
		if (str.equals("out")) { //$NON-NLS-1$
			return Messages.getString("CommonSet.output"); //$NON-NLS-1$
		}
		if (str.equals("in-out")) { //$NON-NLS-1$
			return Messages.getString("CommonSet.inputandoutput"); //$NON-NLS-1$
		}
		if (str.equals("1")) { //$NON-NLS-1$
			return "logic"; //$NON-NLS-1$
		}
		if (str.equals("2")) { //$NON-NLS-1$
			return "request"; //$NON-NLS-1$
		}
		if (str.equals("5")) { //$NON-NLS-1$
			return "session"; //$NON-NLS-1$
		}
		if (str.equals("10")) { //$NON-NLS-1$
			return "application"; //$NON-NLS-1$
		}
		return ""; //$NON-NLS-1$
	}

}
